package com.honeybee.cloud.framework.mybatis.page;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.mapstruct.Mapper;

import java.util.Objects;

/**
 * @Description 生成page
 * @Author DELL
 * @Create 2019-01-09
 * @Since 1.0.0
 */
public class PageMapper {
    public static PageMapper INSTANCE = new PageMapper();
    private PageMapper() {

    }
    public IPage pageInfo(Long page, Long size) {
        IPage iPage = new Page();
        if (Objects.isNull(page)) {
            page = 1L;
        }
        iPage.setCurrent(page);
        if (Objects.isNull(size)) {
            size = 20L;
        }
        iPage.setSize(size);
        return iPage;
    }
}
